using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter03
{
	/// <summary>
	/// Example06: Let's Fly Away!
	/// A commuter airplane takes the route shown in Figure 3.20. 
	/// First, it flies from the origin of the coordinate system 
	/// shown to city A, located 175 km in a direction 30.0^{\circle} north 
	/// of east. Next, it flies 153 km 20.0^{\circle} west of north to 
	/// city B. Finally, it flies 195 km due west to city C. 
	/// Find the location of city C relative to the origin.
	/// </summary>
	public class Example06
	{
		public Example06()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Displacement d1 = new L.Displacement();
			d1.X = 175.0*Math.Cos(30.0*Math.PI/180.0);
			d1.Y = 175.0*Math.Sin(30.0*Math.PI/180.0);
			L.Displacement d2 = new L.Displacement();
			d2.X = 153.0*Math.Cos(110.0*Math.PI/180.0);
			d2.Y = 153.0*Math.Sin(110.0*Math.PI/180.0);
			L.Displacement d3 = new L.Displacement();
			d3.X = -195.0;
    		L.Vector res = d1 + d2 + d3;
			result += Convert.ToString(res.X)+" ";
			result += Convert.ToString(res.Y)+" ";
			result += Convert.ToString(res.Z)+" ";
			result += Convert.ToString(res.Norm)+" ";
		}
	}
}
